package com.wolfking.controller;

import com.wolfking.demo.aggregate.UserInfo;
import com.wolfking.demo.aggregate.UserInfoAggregate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *
 * @author 赵伟伟(wolfking)
 * created on 2019-10-17 19:31
 */
@Slf4j
@RestController
@RequestMapping("/aggregate")
@Api(value = "aggregate", tags = "并发")
public class AggregateController {
    @Autowired
    @SuppressWarnings("all")
    private UserInfoAggregate userInfoAggregate;


    @SneakyThrows
    @GetMapping("/aggregate")
    @ApiOperation(value = "并发控制")
    public UserInfo userInfo( ) {
        long start = System.currentTimeMillis();
        UserInfo userInfo = userInfoAggregate.getUserInfo(100);
        log.info("use {}ms",System.currentTimeMillis()-start);
        return userInfo;
    }
}
